import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LeatherVO, LeatherForm, LeatherQuery } from '@/api/business/leather/types';

/**
 * 查询皮料信息列表
 * @param query
 * @returns {*}
 */

export const listLeather = (query?: LeatherQuery): AxiosPromise<LeatherVO[]> => {
  return request({
    url: '/business/leather/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询皮料信息详细
 * @param id
 */
export const getLeather = (id: string | number): AxiosPromise<LeatherVO> => {
  return request({
    url: '/business/leather/' + id,
    method: 'get'
  });
};

/**
 * 新增皮料信息
 * @param data
 */
export const addLeather = (data: LeatherForm) => {
  return request({
    url: '/business/leather',
    method: 'post',
    data: data
  });
};

/**
 * 修改皮料信息
 * @param data
 */
export const updateLeather = (data: LeatherForm) => {
  return request({
    url: '/business/leather',
    method: 'put',
    data: data
  });
};

/**
 * 删除皮料信息
 * @param id
 */
export const delLeather = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/leather/' + id,
    method: 'delete'
  });
};
